package com.lemon.soft.bookingroom.controller;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Map;


import com.lemon.soft.bookingroom.util.PageUtils;
import com.lemon.soft.bookingroom.util.R;
import com.lemon.soft.bookingroom.vo.updateRoomStatusVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.lemon.soft.bookingroom.entity.RoomTimeStatusEntity;
import com.lemon.soft.bookingroom.service.RoomTimeStatusService;



/**
 * 
 *
 * @author ${author}
 * @email ${email}
 * @date 2025-05-29 12:38:52
 */
@CrossOrigin
@Tag(name = "房间时间状态")
@RestController
@RequestMapping("bookingroom/roomtimestatus")
public class RoomTimeStatusController {
    @Autowired
    private RoomTimeStatusService roomTimeStatusService;


    @Operation(summary = "更新房间状态", description = "status状态：空闲、锁定、预定、使用、维护")
    @PostMapping("/update")
    public R updateRoomStatus(@RequestBody updateRoomStatusVo vo) {
        {
            String success = roomTimeStatusService.updateRoomStatus(vo);
            return R.ok().put("data", success);
        }
    }
        /**
         * 列表
         */

        @Operation(summary = "房间时间状态列表", description = "获取非空闲的")
        @GetMapping("/list")
        public R list () {
            R r = roomTimeStatusService.queryPage();

            return r;
        }


        /**
         * 保存
         */
        @PostMapping("/save")
        public R save (@RequestBody RoomTimeStatusEntity roomTimeStatus){
            roomTimeStatusService.save(roomTimeStatus);

            return R.ok();
        }


        /**
         * 删除
         */
        @PostMapping("/delete")
        public R delete (@RequestBody Integer[]statusIds){
            roomTimeStatusService.removeByIds(Arrays.asList(statusIds));

            return R.ok();
        }

    }

